package com.aaa.marketresearch.dataresource.service;

import com.aaa.marketresearch.dataresource.dao.FamilyDAO;
import com.aaa.marketresearch.dataresource.domain.Family;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Nail
 */

@Service
public class FamilyServiceImpl implements FamilyService {

    @Autowired
    private FamilyDAO familyDAO;

    @Override
    public List<Family> getAll() {
        return familyDAO.getAll();
    }

    @Override
    public Family getById(Integer id) {
        return familyDAO.getById(id);
    }

    @Override
    public Family getByEmail(String email) {
        return familyDAO.getByEmail(email);
    }

    @Transactional
    @Override
    public void save(Family family) {
        familyDAO.save(family);
    }

    @Transactional
    @Override
    public boolean delete(Integer id) {
        return familyDAO.delete(id);
    }
}
